﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data;
using FineUI;
using WebApplication1.MSG;

namespace WebApplication1
{
    public partial class Add_RP3 : System.Web.UI.Page
    {
        string EQID = "000";
      
        protected void Page_Load(object sender, EventArgs e)
        {
            EQID = Request["i"].Trim().ToString();
           
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            if( Text3.Value.ToString().Length>8  &&  Text2.Value.ToString().Length>1 && Text1.Value.ToString().Length>1 )
            {

                Button2.Enabled = false;

                DBS md = new DBS();




            DataSet ds1 = md.EQInfo_By_ID(EQID);

           
           string  DeptID = ds1.Tables[0].Rows[0][6].ToString();
           DBS m = new DBS();
            string dsc = Text1.Value.ToString() + ": " + dscr.Value.ToString();
            string TSKflag = Guid.NewGuid().ToString();
            dsc = dsc.Replace(" ", "");
            m.Add_Task(TSKflag, EQID, dsc, "无", Text2.Value.ToString(), DateTime.Now.ToLocalTime().ToString(), "无", "478", "等待回应", "0", "0", "0", DeptID, "1", "维修", "0", Text3.Value.ToString(), "abcd");

         

            SendMSG sd = new SendMSG();
            string rs = sd.Send("Leon", Text2.Value.ToString() + " 刚刚报修！http://www.cmuam.site/Task_Info_Simple.aspx?Flag=" + TSKflag);
            Response.Redirect("http://cmu.lichuanjia.cn/Finish_Close.aspx", false);

                }
            else
                Response.Write("<script>alert('检查填写内容！')</script>");
        }
    }
}